import {Module} from 'vuex';
// 此处加上 `.ts` 后缀报错，具体原因不详
import {dataTimeState, RootStateTypes} from '/@/store/interface/index';

const dataTimeGlobalModule: Module<dataTimeState, RootStateTypes> = {
    namespaced: true,
    state: {
        dataTime:""
    },
    mutations: {
        //系统日期存储到缓存
        getDataTimeGlobal(state: any,data:object) {
            state.dataTime = data;
            localStorage.setItem("ecoDataTime", JSON.stringify(state.dataTime));
        },
    },
    actions: {
        //设置日期
        setDataTimeGlobal({commit},data:object) {
            commit('getDataTimeGlobal',data);
        },
    },
};
export default dataTimeGlobalModule;
